package gui;

import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.event.MouseEvent;

import core.rendering.RenderableMouse;

/**
 * This class holds the menu item information.
 * 
 * @author Norvin Altamirano Ruiz.
 * 
 */
public abstract class MenuItem extends RenderableMouse {

	private boolean selected;
	Image image;

	public MenuItem() {
		super();
		image = null;
	}

	public MenuItem(int xpos, int ypos) {
		super(xpos, ypos);
	}

	public MenuItem(int xpos, int ypos, int width, int height) {
		super(xpos, ypos);
		this.setSize(new Dimension(width, height));
	}

	@Override
	public void renderComponent(Graphics2D g2d) {
		
		// TODO Auto-generated method stub
		if (image != null) {
			g2d.drawImage(image, (int) this.getX(), (int) this.getY(), null);
		} else {
			g2d.drawString("Image Not Generated Yet", this.getX(), this.getY());
		}
	
	}

	/**
	 * True when object is selected.
	 * 
	 * @return
	 */
	public boolean isSelected() {
		return selected;
	}

	/**
	 * Sets this object selected.
	 * 
	 * @param selected_
	 *            Selected Status.
	 */
	public void setSelected(boolean selected_) {
		selected = selected_;
	}

	@Override
	public boolean onClick(MouseEvent e) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void updateMouse(Point p) {
		// TODO Auto-generated method stub

	}

	@Override
	public void updateLogic() {
		// TODO Auto-generated method stub

	}

	public int getWidth() {
		return (int) size.getWidth();
	}

	public int getHeight() {
		return (int) size.getHeight();
	}

	public abstract void generateImage();

}
